#!/usr/bin/env python
# coding=utf-8
import os
from flask import Flask, render_template, request, make_response, redirect, url_for, flash
from werkzeug.utils import secure_filename

app = Flask(__name__)
app.secret_key = 'some_secret'


@app.route("/")
def index():
    return render_template("index.html")


@app.route("/login", methods=["POST", "GET"])
def login():
    error = None
    if request.method == 'POST':

        if request.form['username'] != "admin" or \
                        request.form['password'] != '1':
            error = "Invalid credentials"
        else:
            flash("You were successfully logged in")
            return redirect(url_for("index"))
    return render_template("login.html", error=error)


if __name__ == '__main__':
    app.debug = True
    app.run()
